<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>

<html>
	<head>
		<title>Showcase - UI Tag Example - Tree Example (Dynamic)</title>
		<sx:head />
	</head>
	<body>
		<!-- START SNIPPET: treeExampleDynamicJsp -->
		<script language="JavaScript" type="text/javascript">
    	dojo.event.topic.subscribe("treeSelected", function treeNodeSelected(node) {
	        dojo.io.bind({
	            url: "<s:url value='ajax/dynamicTreeSelectAction.htm'/>?accept=all&nodeId="+node.node.widgetId,
	            load: dumpData,
	            mimeType: "text/html"
	        });
    	});

    	function dumpData( type, data, evt ) {
    		obj = window.opener.document.getElementById('selectedCatId');
	    	obj.innerHTML = data;
		}

</script>
		<div style="float: left; margin-right: 50px;">
		<s:iterator value="tempGeneralCategoriesList" var="category" >
			<sx:tree id="tree%{#category.categoryId}"
				    rootNode="%{treeMap[#category.categoryId]}"
				    childCollectionProperty="generalCategorieses"
				    nodeIdProperty="categoryId"
				    nodeTitleProperty="categoryName"
				    treeSelectedTopic="treeSelected">
			</sx:tree>
		</s:iterator>

		</div>
		<div id="displayId" class="common-text">
			Please click on any of the tree nodes.
		</div>
		<!-- END SNIPPET: treeExampleDynamicJsp -->
	</body>
</html>